<xsl:template match='/'>
\documentclass{article}
\usepackage[dutch]{babel}
\usepackage[latin1]{inputenc}
\usepackage{array}
\usepackage{a4wide}
\pagestyle{empty}
\renewcommand{\arraystretch}{1.3}
\setlength\textheight{28cm}
\setlength\textwidth{19cm}
\addtolength\voffset{-2.5cm}
\addtolength\hoffset{-2.2cm}
\setlength{\tabcolsep}{0.1cm}
\begin{document}
\noindent
\subsection*{Sint-Ritacollege <xsl:value-of select='//rapport[1]/@jaar' />-<xsl:value-of select='//rapport[1]/@jaar + 1' /> \hfill Overzicht commentaar <xsl:value-of select='//rapport[1]/leerling/klas' /> \hfill Maandrapport <xsl:value-of select='//rapport[1]/@periode' />}
\hrule
\mbox{}
\\[0.5cm]
	<xsl:apply-templates select='//rapport'  />
\end{document}	 
</xsl:template>

<xsl:template match='rapport'>
  <xsl:if test='commentaar//klasleraar'>
    \begin{tabular}{|p{1cm}p{17.5cm}|}
    \hline
    \multicolumn{2}{|c|}{<xsl:value-of select="leerling/voornaam" />&#32;<xsl:value-of select="leerling/achternaam" />}\\
    \hline
    \hline
    <xsl:for-each select="commentaar/*"><xsl:call-template name="commentaar" /></xsl:for-each>
    \end{tabular}
  </xsl:if>
</xsl:template> 

<xsl:template name="commentaar">
<xsl:if test="klasleraar"> 
<xsl:value-of select="name()" />&amp; 
    <xsl:apply-templates select="klasleraar" />\\ \hline
</xsl:if>
</xsl:template>

<xsl:template match="klasleraar">
  <xsl:if test="./@periode='m1'">
    1: <xsl:value-of select="." />
  </xsl:if>
  <xsl:if test="./@periode='m2'">
    2: <xsl:value-of select="." /> 
  </xsl:if>
  <xsl:if test="./@periode='m3'">
    3: <xsl:value-of select="." /> 
  </xsl:if>
  <xsl:if test="./@periode='m4'">
    4: <xsl:value-of select="." /> 
  </xsl:if>
  <xsl:if test="./@periode='m5'">
    5: <xsl:value-of select="." /> 
  </xsl:if>      
</xsl:template>
